package greentycoon.ville;

import greentycoon.batiment.Batiment;
import greentycoon.batiment.Habitation;
import greentycoon.batiment.Route;

import java.util.ArrayList;
import java.util.List;

public class Quartier {

	/*Attributs*/
	private int posX;
	private int posY;
	private int sizeX;
	private int sizeY;
	private Impot impot;
	private Population population;
	private List<Batiment> batimentTab;
	private Pollution pollution;
	
	/*Methodes*/
	
	public Quartier(int x, int y) {
		posX =x;
		posY = y;
		impot = new Impot();
		population = new Population();
		batimentTab = new ArrayList<Batiment>();
		pollution = new Pollution();
	}
	
	public void creerBatiment(Batiment bat)
	{
		if(bat instanceof Habitation)
		{
			((Habitation) bat).setQuartier(this);
		}
		batimentTab.add(bat);
	}
	
	/*public void poserRoutes(){
		int maxPosX = -1;
		int minPosX = 999;
		int maxPosY = -1;
		int minPosY = 999;
		
		for(Batiment b : batimentTab)
		{
			if(!(b instanceof Route)){
				if(b.getPosX()>maxPosX)
				{maxPosX = b.getPosX();}
				if(b.getPosX()<minPosX)
				{minPosX = b.getPosX();}
				if(b.getPosY()>maxPosY)
				{maxPosY = b.getPosY();}
				if(b.getPosY()<minPosY)
				{minPosY = b.getPosY();}
			}
		}
		//routes du haut et du bas
		for(int i = 0; i<maxPosX-minPosX+2; ++i)
		{
			batimentTab.add(new Route(minPosX-1+i,minPosY-1));
			batimentTab.add(new Route(maxPosX+1-i,maxPosY+1));
		}
		 //routes de droite et de gauche
		for(int i = 0; i<maxPosY-minPosY+2; ++i)
		{
			batimentTab.add(new Route(minPosX-1,maxPosY+1-i));
			batimentTab.add(new Route(maxPosX+1,minPosY-1+i));
		}
		
		
	}*/

	public int getPosX() {
		return posX;
	}

	public void setPosX(int posX) {
		this.posX = posX;
	}

	public int getPosY() {
		return posY;
	}

	public void setPosY(int posY) {
		this.posY = posY;
	}

	public Impot getImpot() {
		return impot;
	}

	public void setImpot(Impot impot) {
		this.impot = impot;
	}

	public Population getPopulation() {
		return population;
	}

	public void setPopulation(Population population) {
		this.population = population;
	}
	
	public Pollution getPollution()
	{
		return(pollution);
				
	}

	public int getSizeX() {
		return sizeX;
	}

	public void setSizeX(int sizeX) {
		this.sizeX = sizeX;
	}

	public int getSizeY() {
		return sizeY;
	}

	public void setSizeY(int sizeY) {
		this.sizeY = sizeY;
	}

	public List<Batiment> getBatimentTab() {
		return batimentTab;
	}

	public void setBatimentTab(List<Batiment> batimentTab) {
		this.batimentTab = batimentTab;
	}
	
	

}
